<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title></title>
	<script type="text/javascript" src="js/bootstrap-dropdown.js"></script>
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript" src="js/bootstrap-popover.js"></script>
	<script type="text/javascript" src="js/jscharts.js"></script>
	<link rel="stylesheet" href="css/bootstrap.min.css" />
	<style type="text/css">
		body{
			margin-top:50px;
		}
		.page-header{
			background-color:rgb(240, 245, 248);
		}
		div .page-header well{
			float:left;
		}
		div .span2{
			float:left;
		}
	</style>
	
</head>
<body>
	<div class="navbar navbar-fixed-top">
	  <div class="navbar-inner">
		<div class="container">
			<a class="brand" href="#">
			  <img src="img/user_group.png" alt="" />&nbsp;客户关系管理系统
			</a>
			<ul class="nav">
			  <li >
				<a href="welcome.action">概览</a>
			  </li>
			  <li><a href="contacts.action">通讯录</a></li>
			  <li><a href="tasks.action">任务</a></li>
			  <li class="active"><a href="chances.action">机会</a></li>
			  <li><a href="discuss.action">讨论</a></li>
			  <li class="dropdown" id="menutest1">
				<a class="dropdown-toggle" data-toggle="dropdown" href="#menutest1">
				  添加
				  <b class="caret"></b>
				</a>
				<ul class="dropdown-menu">
				  <li><a href="new_contact.action"><i class="icon-user"></i>&nbsp;联系人</a></li>
				  <li><a href="new_company.action"><i class="icon-home"></i>&nbsp;公司</a></li>
				  <li class="divider"></li>
				  <li><a href="new_task.action"><i class="icon-ok"></i>&nbsp;任务</a></li>
				  <li><a href="new_chance.action"><i class="icon-star-empty"></i>&nbsp;机会</a></li>
				</ul>
			  </li>
			  
			</ul>
			
			<ul class="nav pull-right" >
			  <li>
				<a href="#">${user.username }</a>
			  </li>
			  <li class="dropdown" id="menutest2">
				<a class="dropdown-toggle" data-toggle="dropdown" href="#menutest2">
				  管理
				  <b class="caret"></b>
				</a>
				<ul class="dropdown-menu">
				   <li><a href="manage_user.action?id=${sessionScope.user.id }"><i class="icon-user"></i>&nbsp;同事</a></li>
				  <li><a href="manage_group.action"><i class="icon-list-alt"></i>&nbsp;组</a></li>
				  <li class="divider"></li>
				<!--  <li><a href="user_update_user.action?id=${sessionScope.user.id }"><i class="icon-asterisk"></i>&nbsp;账号</a></li> -->
				  <li><a href="show_user_msg.action?id=${sessionScope.user.id }"><i class="icon-asterisk"></i>&nbsp;账号</a></li>
				</ul>
			  </li>
			  <li class="divider-vertical"></li>
			  <li><a href="sign_in.action">退出</a></li>
			</ul>
			
		</div>
	  </div>
	</div>
	
	<div class="container">
		
			<div class="row">
				  
				  <div class="span8">
					
						<div class="page-header well">
						  <h2><img src="img/chances.jpg" alt="" />&nbsp;所有的机会 </h2>
					
						</div>	
						<div class="page-header well">
					
							<table class="table">
							  <tbody>
							  		<tr >
							  			<td>机会名称</td>
							  			<td>联系人</td>
							  			<td>创建时间</td>
							  			<td>创建人</td>
							  		</tr>
							  	
							  		
							  		<c:forEach items="${list }" var="chance">
									<c:if test="${chance.view == 'all' }">
								
									<tr>
									  <td>
											<a  data-content=" ${chance.content }"  rel="popover"  href="talk.action?id=${chance.id }"  data-original-title="机会的内容"  class="gh"  res="${chance.id }"  id="gh" >	<img src="img/57.gif" alt="" />${chance.title }</a>
										</td>	
									<td>
										<img src="img/70.gif" alt="" />${chance.contacts.name }
									</td>
									<td>
										<img src="img/71.gif" alt="" />${chance.createtime }
									</td>
										<td><img src="img/28.gif" alt=""  style="height:20px;width=20px;">${chance.user.username }</td>
									</tr>
									
								</c:if>
								<c:if test="${chance.view == 'me' }">
									<c:if test="${chance.user.id == sessionScope.user.id }">
										<tr>
									  <td>
									<a data-content=" ${chance.content }"  rel="popover"  href="talk.action?id=${chance.id }" data-original-title="机会的内容"  class="gh"  ><img src="img/57.gif" alt="" />	${chance.title }</a>
									</td>
									<td>
										<img src="img/70.gif" alt="" />${chance.contacts.name }
									</td>
									<td>
										<img src="img/71.gif" alt="" />${chance.createtime }
									</td>
									<td><img src="img/28.gif" alt=""  style="height:20px;width=20px;">${chance.user.username }</td>
									</tr>
									</c:if>
								</c:if>
								
								<c:if test="${chance.view  != 'all' and chance.view != 'me'}">
									<c:if test="${chance.user.id == sessionScope.user.id }">
									<tr>
									  <td>
												<a  data-content="  ${chance.content }"  rel="popover"  href="talk.action?id=${chance.id }" data-original-title="机会的内容"   class="gh" >	<img src="img/57.gif" alt="" />${chance.title }</a>
									<td>
										<img src="img/70.gif" alt="" />${chance.contacts.name }
									</td>
									<td>
										<img src="img/71.gif" alt="" />${chance.createtime }
									</td>
										<td><img src="img/28.gif" alt=""  style="height:20px;width=20px;">${chance.user.username }</td>
									</tr>
									</c:if>
								</c:if>
								
								<c:if test="${chance.view  != 'all' and chance.view != 'me'}">
									<c:if test="${chance.view == userGroup.groupname  and chance.user.id != sessionScope.user.id}">
									<tr>
									  <td>
										<a  data-content=" ${chance.content }"  rel="popover"  href="talk.action?id=${chance.id }" data-original-title="机会的内容"   class="gh" ><img src="img/57.gif" alt="" />${chance.title }</a>
									<td>
										<img src="img/70.gif" alt="" />${chance.contacts.name }
									</td>
									<td>
										<img src="img/71.gif" alt="" />${chance.createtime }
									</td>
									<td><img src="img/28.gif" alt=""  style="height:20px;width=20px;">${chance.user.username }</td>
									</tr>
									</c:if>
								</c:if>
								
								</c:forEach>
									
									
								
							  </tbody>
						</table>
					
				  </div>	
				 <div id="chartcontainer" style="display:none;" >This is just a replacement in case Javascript is not
available or used for SEO purposes</div>
	
		</div>
		
		  <div class="span4">
				  		
						  
						<div class="page-header well">
							<table class="table">
								<h3>机会管理</h3>
							  <tbody>
								<tr>
								<td> <a href="add.action"><img src="img/chance.png" alt="" />创建机会</a></td>
								</tr>
								<tr>
								  <td><a href="show_edit.action"><img src="img/chance.png" alt="" />修改机会</a></td>
								</tr>
								<tr>
								  <td><a href="show_edit.action"><img src="img/chance.png" alt="" />删除机会</a></td>
								</tr>
								<tr>
									<td><img src="img/chances.jpg" alt="" /><a href="javascript:;" id="btn">天数与金钱</a></td>
								</tr>
							  </tbody>
							</table>
						</div>	
	<script type="text/javascript">
			var myData = new Array([10, 20], [15, 10], [20, 30], [25, 10], [30, 5]);
			var myData2 = new Array([10, 10], [15, 5], [25, 25], [30, 20]);
			var myChart = new JSChart('chartcontainer', 'line');
			myChart.setDataArray(myData, 'line_1');
			myChart.setDataArray(myData2, 'line_2');
			myChart.draw();
		$(document).ready(function(){
			$("#new_task").click(function(){
				$('#myModal').modal({
					backdrop:true,
					keyboard:true,
					show:false
				});
			});
			
			$(".gh").popover({
		
		trigger:"hover",
		placement:"bottom"
		});
		$("#btn").click( function(){
		 $("#chartcontainer").css("display","block");
			
		});
		$("#btn").blur( function(){
		 $("#chartcontainer").css("display","none");
		});
		});
	</script>
</body>
</html>